home *** CD-ROM | disk | FTP | other *** search
/ PC Play 129 / pc play 129.iso / Demo / man2 / man2.exe / data / scripts / 6_leviathan_human_scripts.lua < prev    next >
Encoding:
Text File  |  2006-01-26  |  6.6 KB  |  176 lines

  1.  
  2.  
  3. function units_cruiser_human_setup()
  4.     units_setup_sea(10,true,true,ENET_EFFECT_GEOMETRY_CRUISERSHADOW)
  5. end
  6.  
  7. function units_cruiser_human_resetup()
  8.     units_setup_sea(10,true,false,ENET_EFFECT_GEOMETRY_CRUISERSHADOW)
  9. end
  10.  
  11. function units_cruiser_human_select()
  12.     units_select(25,4)
  13. end
  14.  
  15. function units_cruiser_human_unselect()
  16.     units_unselect()
  17. end
  18.  
  19. function units_cruiser_human_selectenemy()
  20.     uniGetExecutor():addSimpleEffect(ENET_EFFECT_SELECTEDGEOMETRY_ENEMY)
  21. end
  22.  
  23. function units_cruiser_human_damaged()
  24.     uniGetExecutor():applyDamage(uniGetLife())
  25. end
  26.  
  27. function units_cruiser_human_highlight()
  28.     uniGetExecutor():addEffectWithRadius(ENET_EFFECT_GEOMETRY_HIGHLIGHT,15)
  29. end
  30.  
  31. function units_cruiser_human_explode()
  32.     units_explode_water1()
  33. end
  34.  
  35. function units_cruiser_human_fire1()
  36.     uniSetLife(uniGetLife() / 2.0)
  37.     local unit = uniGetExecutor()
  38.     unit:play3DSound("cruiser gun rotate2.wav",0)
  39.  
  40.     if(unit:getObjectPositionInLocalSpace(uniGetTarget()).z > 0) then
  41.         waitDeath(unit:getBone(ENBT_GUNTOWER):addRotationEffect(ENET_EFFECT_ROTATE_GUNTOWERTOTARGET,MATH_PI,uniGetTarget()))
  42.     else
  43.         waitDeath(unit:getBone(ENBT_GUNTOWER):addRotationEffect(ENET_EFFECT_ROTATE_GUNTOWERDEFAULT,MATH_PI))
  44.         waitDeath(unit:addRotationEffect(ENET_EFFECT_ROTATE_UNITTOTARGET,MATH_PI * 0.6,uniGetTarget()))
  45.     end
  46.  
  47.     local recoils = {}
  48.     recoils[0] = unit:getBone(ENBT_GUNRECOILED,0)
  49.     recoils[1] = unit:getBone(ENBT_GUNRECOILED,1)
  50.  
  51.     recoils[0]:addRotationEffect(ENET_EFFECT_ROTATE_GUNTOTARGET,MATH_PI / 3.0,uniGetTarget())
  52.     waitDeath(recoils[1]:addRotationEffect(ENET_EFFECT_ROTATE_GUNTOTARGET,MATH_PI / 3.0,uniGetTarget()))
  53.  
  54.     local firespots = {}
  55.     firespots[0] = unit:getBone(ENBT_FIRE2,0)
  56.     firespots[1] = unit:getBone(ENBT_FIRE2,1)
  57.  
  58.     unit:play3DSound("cruiser dot fire.wav",0)
  59.     firespots[0]:addSimpleEffect(ENET_EFFECT_CRUISERSHOT_FLY):executeCommand(ENC_FIRE1)
  60.     local lightspotstat1 = firespots[0]:addSimpleEffect(ENET_EFFECT_CRUISER_LIGHTSPOT)
  61.     local shot2 = firespots[0]:addSimpleEffect(ENET_EFFECT_PS_CRUISERSHOT)
  62.     recoils[1]:gunRecoil(0,0.3,10)
  63.  
  64.     pause(0.5)
  65.  
  66.     unit:play3DSound("cruiser dot fire.wav",0)
  67.     firespots[1]:addSimpleEffect(ENET_EFFECT_CRUISERSHOT_FLY):executeCommand(ENC_FIRE1)
  68.     local lightspotstat2 = firespots[1]:addBulletEffect(ENET_EFFECT_CRUISER_LIGHTSPOT)
  69.     local shot2_2 = firespots[1]:addSimpleEffect(ENET_EFFECT_PS_CRUISERSHOT)
  70.     recoils[0]:gunRecoil(0,0.3,10)
  71.  
  72.     shot2:suspendedDestroy(2.5)
  73.     shot2_2:suspendedDestroy(2.5)
  74.     lightspotstat1:suspendedDestroy(2.0)
  75.     lightspotstat2:suspendedDestroy(2.0)
  76.     pause(1.5)
  77.  
  78.     unit:addFireArrow()
  79. end
  80.  
  81. function units_cruiser_human_fire2()
  82.     local unit = uniGetExecutor()
  83.     unit:addAnimationToQueue(ENAT_PREPAREFORFIRE1,1)
  84.     unit:addAnimationToQueue(ENAT_FIREPOSITION1,MATH_INFINITY)
  85.     unit:play3DSound("cruiser gun up4.wav",0)
  86.     while(unit:getCurrentAnimation() ~= ENAT_FIREPOSITION1) do pause() end
  87.     unit:play3DSound("cruiser generate field3.wav",0)
  88.     local gt = unit:getBone(ENBT_GUNTOWER,1)
  89.     waitDeath(gt:addRotationEffect(ENET_EFFECT_ROTATE_GUNTOWERTOTARGET,MATH_PI,uniGetTarget()))
  90.     local firespots = {}
  91.     firespot = unit:getBone(ENBT_FIRE1,0)
  92.     local shotcharge = firespot:addBulletEffect(ENET_EFFECT_PS_CRUISERSHOTCHARGE)
  93.     local lightspotstat = firespot:addBulletEffect(ENET_EFFECT_CRUISER_LIGHTSPOT2)
  94.     shotcharge:setLocalPosition(0,0,-5)
  95.     pause(1.0)
  96.     firespot:addSimpleEffect(ENET_EFFECT_CRUISERSHOT_FLY2):executeCommand(ENC_FIRE2)
  97.     pause(1.0)
  98.     unit:play3DSound("explosion.wav",0)
  99.     shotcharge:suspendedDestroy(4.0)
  100.     lightspotstat:destroy()
  101.     pause(1.0)
  102.     unit:play3DSound("cruiser gun back3.wav",0)
  103.     waitDeath(gt:addRotationEffect(ENET_EFFECT_ROTATE_GUNTOWERDEFAULT,MATH_PI,uniGetTarget()))
  104.     unit:setCurrentAnimationRepeatCount(0)
  105.     unit:addAnimationToQueue(ENAT_AFTERFIRE1,1)
  106.     unit:addFireArrow()
  107. end
  108.  
  109. function units_cruiser_human_move()
  110.     local unit = uniGetExecutor()
  111.     local sound = unit:play3DSound("cruiser moves2.wav",1)
  112.     waitDeath(unit:addRotationEffect(ENET_EFFECT_ROTATE_UNIT,MATH_PI * 0.6))
  113.     waitDeath(unit:addMoveEffect(ENET_EFFECT_MOVE_LINEAR,80))
  114.     sound:destroy()
  115.     end
  116.  
  117. -- register functions to unit scriptset - they will be called when specified command arrives to unit
  118. registerCommand(ENSCRIPTSET_LEVIATHAN_HUMAN,ENC_MOVE,"units_cruiser_human_move")
  119. registerCommand(ENSCRIPTSET_LEVIATHAN_HUMAN,ENC_FIRE1,"units_cruiser_human_fire1")
  120. registerCommand(ENSCRIPTSET_LEVIATHAN_HUMAN,ENC_FIRE2,"units_cruiser_human_fire2")
  121. registerCommand(ENSCRIPTSET_LEVIATHAN_HUMAN,ENC_SELECT,"units_cruiser_human_select")
  122. registerCommand(ENSCRIPTSET_LEVIATHAN_HUMAN,ENC_SELECTENEMY,"units_cruiser_human_selectenemy")
  123. registerCommand(ENSCRIPTSET_LEVIATHAN_HUMAN,ENC_UNSELECT,"units_cruiser_human_unselect")
  124. registerCommand(ENSCRIPTSET_LEVIATHAN_HUMAN,ENC_SETUP,"units_cruiser_human_setup")
  125. registerCommand(ENSCRIPTSET_LEVIATHAN_HUMAN,ENC_RESETUP,"units_cruiser_human_resetup")
  126. registerCommand(ENSCRIPTSET_LEVIATHAN_HUMAN,ENC_DAMAGED,"units_cruiser_human_damaged")
  127. registerCommand(ENSCRIPTSET_LEVIATHAN_HUMAN,ENC_EXPLODE,"units_cruiser_human_explode")
  128. registerCommand(ENSCRIPTSET_LEVIATHAN_HUMAN,ENC_HIGHLIGHT,"units_cruiser_human_highlight")
  129.  
  130. -- make description of unit
  131. desc = getEffectDescriptionP(ENET_UNIT_LEVIATHAN_HUMAN)
  132. desc.ClassID = ENCLASS_MESHINSTANCE
  133. desc.EffectClassType = ENECT_GEOMETRY
  134. desc.FileName = "leviathan_fnu.rmd"
  135. desc.ScriptSet = ENSCRIPTSET_LEVIATHAN_HUMAN
  136. desc.MoveType = ENMOVE_SWIM
  137. desc.RenderType = ENRENDERTYPE_GEOMETRY
  138. desc.Material = ENMAT_RIGIDSKINNEDMESH
  139. desc.MaterialColors = units_materialcolors_human
  140.  
  141. -- shadow
  142. desc = getEffectDescriptionP(ENET_EFFECT_GEOMETRY_CRUISERSHADOW)
  143. desc.ClassID = ENCLASS_MESHINSTANCE
  144. desc.EffectClassType = ENECT_GEOMETRY
  145. desc.FileName = "cruiser_shadow.rmd"
  146. desc.RenderType = ENRENDERTYPE_SHADOW
  147. desc.Material = ENMAT_SHADOW
  148. desc.MaterialColors = units_materialcolors_shadow
  149.  
  150. -- register new unit to logic
  151. unitDesc = logic_getUnitDescP(41)
  152. unitDesc.group = 1
  153. unitDesc.order = 5
  154. unitDesc.unit_res_id = ENET_UNIT_LEVIATHAN_HUMAN
  155. unitDesc.unit_icon_id = "Sealauncher_alienhuman_h_small_normal.dds"
  156. unitDesc.active_id = "Sealauncher_alienhuman_h_small_active.dds"
  157. unitDesc.pressed_id = "Sealauncher_alienhuman_h_small_pressed.dds"
  158. unitDesc.big_icon_id = "Sealauncher_alienhuman_h_big_normal.dds"
  159. unitDesc.small_icon_id = "Leviathan_l_human_stats.dds"
  160. unitDesc.HP = 10
  161. unitDesc.MP = 40
  162. unitDesc.WR = 4
  163. unitDesc.min_WR = 1
  164. unitDesc.WD = 2
  165. unitDesc.WR2 = 4
  166. unitDesc.min_WR2 = 1
  167. unitDesc.WD2 = 3
  168. unitDesc.ability = 3
  169. unitDesc.transport = 0
  170. unitDesc.value = 10
  171. unitDesc.race = 0
  172. unitDesc.fire_pause = 0.6
  173. unitDesc.move_pause = 0.5
  174. unitDesc.unit_info_scale = 0.07
  175. unitDesc.scn_name = "MCRUISERH"
  176.